package com.example.springdata.dao.entity;

import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.UUID;

@Entity
@Table(name="book")
public class Book {
    private String id;
    private String name;
    private int price;
    private LocalDate publishDate;
    private LocalDateTime createDate;
    private String publisher;
    @Id
    @Column(name="id",length=32)
    public String getId() {
        if (id == null) id = UUID.randomUUID().toString().replace("-", "");
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
    @Column(name="name",length=32)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    @Column(name="price")
    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }
    @Column(name="publish_date")
    public LocalDate getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(LocalDate publishDate) {
        this.publishDate = publishDate;
    }
    @Column(name="create_date")
    public LocalDateTime getCreateDate() {
        return createDate;
    }

    public void setCreateDate(LocalDateTime createDate) {
        this.createDate = createDate;
    }
    @Column(name="publisher")
    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
    }
}
